module MUL_DIV(
    input [31:0] valA,
    input [31:0] valB,
    input [1:0] mult_div_op,
    output [31:0] hi,
    output [31:0] lo
);
    wire [63:0] hilo = GetHiLo(valA, valB, mult_div_op);

    assign hi = hilo[63:32];
    assign lo = hilo[31:0];

    function [63:0] GetHiLo;
        input [31:0] valA;
        input [31:0] valB;
        input [1:0] mult_div_op;
        case (mult_div_op)
            2'b00: begin
                GetHiLo = $signed(valA) * $signed(valB);
            end
            2'b01 : begin
                GetHiLo = valA * valB;
            end
            2'b10: begin
                GetHiLo[63:32] = $signed(valA) % $signed(valB);
                GetHiLo[31:0]  = $signed(valA) / $signed(valB);
            end
            2'b11: begin
                GetHiLo[63:32] = valA % valB;
                GetHiLo[31:0]  = valA / valB;
            end
            // 2'b01: GetHiLo = valA * valB;
            // 2'b10: GetHiLo =valA / valB;
            // 2'b11: GetHiLo = valA / valB;
            default: GetHiLo = 0;
        endcase
        
        
    endfunction
endmodule // MUL_DIB